package com.ryzx.jpa.helper.base;

import jakarta.persistence.Column;
import jakarta.persistence.EntityListeners;
import jakarta.persistence.MappedSuperclass;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.util.Date;

@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
@Getter
@Setter
public class BapAuditableEntity<U> extends BapBaseEntity {
    @CreatedBy
    @Column(name = "c_by")
    private U createdBy;

    @CreatedDate
    @Column(name = "c_date")
    private Date createdDate;

    @LastModifiedBy
    @Column(name = "m_by")
    private U lastModifiedBy;

    @LastModifiedDate
    @Column(name = "m_date")
    private Date lastModifiedDate;
}
